#region

using System;
using System.Windows.Forms;
using EditeurSyntaxiqueVocal.Class;
using System.IO;
using EditeurSyntaxiqueVocal.Forms;
#endregion

namespace EditeurSyntaxiqueVocal.Controls
{
    public partial class StartPageOnglet : UserControl
    {
        private static ListeRecentFiles _recentFiles;

        public StartPageOnglet()
        {
            InitializeComponent();
        }

        public static ListeRecentFiles RecentFiles
        {
            get { return _recentFiles; }
            set { _recentFiles = value; }
        }

        public event EventHandler New;

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (New != null)
                New(sender, null);
        }

        public event EventHandler Open;

        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (Open != null)
                Open(sender, null);
        }

        public static event EventHandler OnRecentFileLinkCliked;

        public static void onRecentFileLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (OnRecentFileLinkCliked != null)
                OnRecentFileLinkCliked(sender, e);
        }

        private void userControl12_Load(object sender, EventArgs e)
        {
            RecentFiles = new ListeRecentFiles();
            ListeRecentFiles files = RecentFileMaping.OuvrirLitseRecentFile();
            foreach (TokenRecentFile file in files)
                RecentFiles.Add(file);
            //int nb = 0;
            //foreach (TokenRecentFile tokenRecent in RecentFiles)
            //{
            //    RecentFileStartPage recentFileStartPage =
            //        new RecentFileStartPage(null, Path.GetFileName(tokenRecent.PathFile));
            //    RecentFilesGroup.Panel.Controls.Add(recentFileStartPage);
            //    //recentFileStartPage.NomFileLinkLabel.LinkClicked += onRecentFileLinkClicked;
            //    //
            //    nb++;
            //    if (nb == RecentFileMaping.TaileRecetFileMenu)
            //        break;
            //}
        }

        private void userControl13_Load(object sender, EventArgs e)
        {
        }

        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            webBrowser1.Visible = webBrowser1.IsOffline;
        }
    }
}